﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
  public  class TheLoai_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
      public DataTable layDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_TheLoai");
      }
      public int insert_TheLoai(TheLoai_public tenTheLoai,TheLoai_public ghiChu)
      {
          int Nparameter = 2;
          string[]name=new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@TenTheLoai";
          value[0] = tenTheLoai.TenTheLoai;
          name[1] = "@GhiChu";
          value[1] = ghiChu.GhiChu;
          return kn.update("Insert_TheLoai",name,value,Nparameter);
      }
      public int update_TheLoai(TheLoai_public maTheLoai,TheLoai_public tenTheLoai, TheLoai_public ghiChu)
      {
          int Nparameter = 3;
          string[] name = new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@MaTheLoai";
          value[0] = maTheLoai.MaTheLoai;
          name[1] = "@TenTheLoai";
          value[1] = tenTheLoai.TenTheLoai;
          name[2] = "@GhiChu";
          value[2] = ghiChu.GhiChu;
          return kn.update("Update_TheLoai", name, value, Nparameter);
      }
      public int delete_TheLoai(TheLoai_public maTheLoai)
      {
          int Nparameter = 1;
          string[] name = new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@MaTheLoai";
          value[0] = maTheLoai.MaTheLoai;
          return kn.update("Delete_TheLoai", name, value, Nparameter);
      }
    }
}
